<!-- 审计日志 -->
<template>
  <div class="dashboard-editor-container">
		<el-row style="background: #fff; padding: 16px 16px 0;">
      <connsearch ref="connsearch" :formOptions="formOptions"   @search="search" @reset="reset"/>
      <div class="tabclick">
        <!-- <div class="tabitem" @click="handleClick1()">
          <span>显示日统计趋势<i :class="tab1 ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i></span>
        </div> -->
        <div class="tabitem" @click="handleClick()">
          <span><i :class="tab ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i></span>
        </div>
      </div>
      <el-row>
        <el-tabs type="border-card" v-if="tab" style="margin-top:16px;" @tab-click="tabClick">
          <el-tab-pane label="日期趋势" lazy>
            <el-col :xs="24" :sm="24" :lg="24">
              <barchart :title="'日期趋势'" :chartData="barchartData" @barclick="echartsClick"/>
            </el-col>
          </el-tab-pane>
          <el-tab-pane label="用户分析" lazy>
            <el-row :gutter="20">
              <el-col :xs="24" :sm="24" :lg="24">
                <piechart :title="'用户分析'" :chartData="pie1Data"  @pieclick="echartsClick"/>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="域名分类" lazy>
            <el-col :xs="24" :sm="24" :lg="24">
              <piechart :title="'域名分类'" :chartData="pie2Data"  @pieclick="echartsClick"/>
            </el-col>
          </el-tab-pane>
          <!-- <el-tab-pane label="按域名小分类统计" lazy>
            <el-col :xs="24" :sm="24" :lg="24">
              <piechart :title="'按域名小分类统计'" :chartData="pie3Data"  @pieclick="echartsClick"/>
            </el-col>
          </el-tab-pane> -->
          <el-tab-pane label="审计结果" lazy>
            <el-col :xs="24" :sm="24" :lg="24">
              <piechart :title="'审计结果'" :chartData="pie4Data"  @pieclick="echartsClick"/>
            </el-col>
          </el-tab-pane>
        </el-tabs>
      </el-row>
      <!-- <barchart /> -->

      <el-col :xs="{ span: 24 }" :sm="{ span: 24 }" :md="{ span: 24 }" :lg="{ span: 24 }" :xl="{ span: 24 }" style="padding-right: 8px;margin: 16px 0;">
        <!-- <span class="title">审计日志列表</span> -->
        <el-table stripe  :data="tableData" style="width: 100%; margin-top: 15px">
          <el-table-column label="序号"  width="60px" type="index" :index='(index)=>{return (index + 1) + (this.pageNum - 1)*this.pageSize}'> </el-table-column>
          <el-table-column label="访问时间" prop="TransTime" align="left" width="160px"></el-table-column>
          <!-- <el-table-column label="终端名称" prop="Name" align="left" width="160px">
            <template slot-scope="{row}">
              {{ row.Name || '--' }}
            </template>
          </el-table-column> -->
          <el-table-column label="终端地址" prop="FromIP" show-overflow-tooltip align="left" width="140px"></el-table-column>
          <!-- <el-table-column label="域名标题" prop="Title" show-overflow-tooltip align="left" width="160px"></el-table-column> -->
          <el-table-column label="域名" prop="URL" show-overflow-tooltip align="left" width="230px"></el-table-column>
          <el-table-column label="域名分类" prop="Class" show-overflow-tooltip align="left" ></el-table-column>
          <el-table-column label="二级分类" prop="SubClass" show-overflow-tooltip align="left" ></el-table-column>
          <el-table-column label="注册地址" prop="RegAddr" show-overflow-tooltip align="left" ></el-table-column>
          <el-table-column label="注册国家" prop="Country" show-overflow-tooltip align="left" ></el-table-column>
          <el-table-column label="注册国家编码" prop="Code" show-overflow-tooltip align="left" width="120px" ></el-table-column>
          <el-table-column label="描述备注" prop="Descp" show-overflow-tooltip align="left" ></el-table-column>
          <el-table-column label="安全检测" prop="Security" show-overflow-tooltip align="left" ></el-table-column>
          <!-- <el-table-column label="所在地区" prop="Area" show-overflow-tooltip align="left"></el-table-column> -->
          <el-table-column label="审计策略" show-overflow-tooltip align="left" width="80px">
            <template slot-scope="scope">
              <p style="color:#67C23A" v-if="scope.row.AccessType === '加速'">加速</p>
              <p style="color:#909399" v-if="scope.row.AccessType === '直连'">直连</p>
              <p style="color:#F56C6C" v-if="scope.row.AccessType === '禁止'">禁止</p>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="left" width="300px" fixed="right">
            <template slot-scope="scope">
              <!-- <el-button size="mini" @click="changeMailGlobal(scope.row)">修改</el-button> -->
              <el-button size="mini" type="success" @click="openUrlDialog(scope.row, 'release')">加入放行</el-button>
              <el-button size="mini" type="danger" @click="openUrlDialog(scope.row, 'blocking')">加入阻断</el-button>
              <el-button size="mini" type="primary" @click="openUrlDialog(scope.row, 'free')">加入免记录</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page=pageNum
          :page-size=pageSize
          background
          layout="total, prev, pager, sizes, next, jumper"
          :total="total">
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog
      title="添加域名"
      :close-on-click-modal="false"
      :close-on-press-escape=false
      :visible.sync="dialogVisible"
      v-el-drag-dialog
      width="calc(21% - 13px)">
      <div class="Dialog-title" style="margin-bottom:10px;">请输入域名:</div>
      <el-input v-model="omainName" :maxlength="500"></el-input>
      <!--底部分割线 -->
        <el-divider class="lineToFooter"></el-divider>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitUrl()">确 定</el-button>
        <el-button type="info" @click="dialogVisible = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import Cookies from 'js-cookie'
import { getNowDay, parseTime, getTreeData, ParamDictURLtype, Maintype } from '@/utils/index.js';
import { connrequest } from '@/api/firstPage.js';
import connsearch from "@/components/connSearch";
import barchart from "./components/barchart.vue";
import piechart from "./components/piechart.vue";
import elDragDialog from '@/directive/el-drag-dialog' // base on element-ui
export default {
  components: { connsearch, barchart, piechart },
  directives: { elDragDialog },
  data() {
    let that = this
    return {
      activeName:'按日统计',
      tabTitle: '日期趋势',
      operationType: '',
      omainName: '',
      tableData:[],
      pageNum: 1,
      pageSize: 10,
      total: 0,
      tab: false,
      tab2: false,
      dialogVisible: false,
      UrlList: [],
      barchartData: {xAxis:[],series:[]},
      pie1Data: [],
      pie2Data: [],
      pie3Data: [],
      pie4Data: [],
      searchform:{},
      searchobj: {},
      formOptions:[
        {
          col: 8,
          label: "日期",
          prop: "timeRange",
          element: "el-date-picker",
          initValue: [],
          type: "",
          events: {
            input(val) {
              that.searchform.timeRange = val
            }
          }
        },
        {
          col: 4,
          label: "统计排名",
          prop: "rank",
          element: "el-select",
          initValue: 10,
          options: [
            { label: '前十名', value: 10 },
            { label: '前二十名', value: 20 },
            { label: '前三十名', value: 30 }
          ],
          events: {
            input(val) {
              that.searchform.rank = val
            }
          }
        },
        {
          label: "域名分类",
          prop:"type",
          element: "el-select",
          initValue: "",
          placeholder: "请选择域名分类",
          options:[
            { label: '全部', value: '' }
          ],
          events: {
            input(val) {
              that.searchform.type = val
            }
          }
        },
         {
          col: 6,
          label: "审计策略",
          prop: "AccessType",
          element: "el-select",
          initValue: 0,
          placeholder: "请选择审计策略",
          options:[
            { label: "全部", value: 0},
            { label: "禁止", value: 1},
            { label: "加速", value: 2},
            { label: "直连", value: 3}
          ],
          events: {
            input(val) {
              that.searchform.AccessType = val
            }
          }
        },
        // {
        //   label: "终端用户",
        //   prop:"Name",
        //   element: "el-cascader",
        //   initValue: "",
        //   checkStrictly: false,
        //   placeholder: "请选择终端用户",
        //   options:[],
        //   events: {
        //     input(val) {
        //       that.searchform.Name = val
        //     },
        //   },
        // },
        {
          col: 8,
          label: "域名",
          prop: "URL",
          element: "el-input",
          placeholder: "请输入域名,支持模糊查询。",
          maxlength: 50,
          events: {
            input(val) {
              that.searchform.URL = val
            }
          }
        }

      ]
    };
  },
  //生命周期 - 创建完成（访问当前this实例）
  created() {
    this.pageSize = Cookies.get('DefaultPageLength') * 1
    let xTime = new Date().getTime()
    let endTime = new Date(new Date().setHours(0, 0, 0, 0))
    let startTime = endTime - (Cookies.get('DefaultLogDays') * 1 * 3600 * 24 * 1000);
    // let arr = [ parseTime(startTime), parseTime(xTime)]
    let arr = [ parseTime(startTime), '']
    this.formOptions.map( item => {
      if(item.label === '日期'){
        item.initValue = arr
      }
    })
    this.$set(this.searchform,'timeRange', arr)
    this.$set(this.searchform,'type', '')
    this.$set(this.searchform,'AccessType', '')
    this.GetParamDictURL()
    this.getData()
    this.GetDepartment()
  },
  //生命周期 - 挂载完成（访问DOM元素）
  mounted() {
  },
  methods:{
    getData(){
      this.GetShadowURLLog()
      switch (this.tabTitle) {
        case '日期趋势':
          this.GetShadowURLSumGroupByDate()
          break;
        case '用户分析':
          this.GetShadowURLSumGroupByIp()
          break;
        case '域名分类':
          this.GetShadowURLSumGroupByMainClass()
          break;
        case '审计结果':
          this.GetShadowURLSumGroupByAccessType()
          break
        default:
          this.GetShadowURLSumGroupBySubClass()
          break;
      }
    },
    async openUrlDialog(row, operationType){
      this.operationType = operationType
      this.omainName = row.URL
      const res = await connrequest(operationType === 'blocking' ? 'GetForbiddenURL' : operationType === 'free' ? 'GetAuditFreeDomain':'GetV2rayURL')
      let UrlList = []
      res.Data = res.Data || []
      res.Data.map(item => {
        UrlList.push({url: item})
      })
      this.UrlList = UrlList
      this.dialogVisible = true
    },
    async submitUrl(){
      if(!this.omainName){
        this.$message.error('域名不能为空')
        return false
      }
      if(this.operationType === 'blocking'){
        if(this.UrlList.find(item => item.url === this.omainName) !== undefined){
          this.$message.error('该域名已经在阻断名单')
          return false
        }
        let data = {
          Data:{URL: this.omainName}
        }
        const res = await connrequest('AddForbiddenURL', data)
        if(res.Status.StatusCode === 0){
          this.$message.success('域名加入阻断成功')
          this.searchobj = {}
          this.pageNum = 1
          this.getData()
          this.dialogVisible = false
        }
      }else if(this.operationType === 'release'){
        this.omainName = this.omainName.replace(/^https?\:\/\//i, '')
        if(this.UrlList.find(item => item.url === this.omainName) !== undefined){
          this.$message.error('该域名已经在加速名单')
          return false
        }
        let data = {
          Data:{URL: this.omainName}
        }
        const res = await connrequest('AddV2rayURL', data)
        if(res.Status.StatusCode === 0){
          this.$message.success('域名加入放行成功')
          this.searchobj = {}
          this.pageNum = 1
          this.getData()
          this.dialogVisible = false
        }
      }else {
        if(this.UrlList.find(item => item.url === this.omainName) !== undefined){
          this.$message.error('该域名已经在免记录名单')
          return false
        }
        let data = {
          Data:{Domain: this.omainName}
        }
        const res = await connrequest('AddAuditFreeDomain', data)
        if(res.Status.StatusCode === 0){
          this.$message.success('域名加入免记录成功')
          this.searchobj = {}
          this.pageNum = 1
          this.getData()
          this.dialogVisible = false
        }
      }
    },
    echartsClick(val, title, id){
      this.pageNum = 1
      if(title === '日期趋势'){
        this.searchobj = { StartTime: `${val} 00:00:00`, EndTime: `${val} 23:59:59` }
        this.GetShadowURLLog(this.searchobj)
      }else if(title === '用户分析'){
        this.searchobj = { Name: val }
        this.GetShadowURLLog(this.searchobj)
      }else if(title === '审计结果'){
        this.searchobj = { AccessType: val === '禁止' ? 1 : (val === '加速' ? 2 : 3) }
        this.GetShadowURLLog(this.searchobj)
      }else if(title === '域名分类'){
        // let arr;
        // if(val.length > 0){
        //   let subClass = val
        //   arr = this.Options.filter(item => {return item.SubClass === subClass})
        // }
        this.searchobj = {
          // MainClassID: arr?.length > 0 ? arr[0].MainID : 0
          URLClass: val = val === '未知分类'? "":val
        }
        if(val === '未知分类'){
          this.searchobj.MainClassID = 999
        }
        this.GetShadowURLLog(this.searchobj)
      }
      // else if(title === '按域名小分类统计'){
      //   let arr;
      //   if(val.length > 0){
      //     let subClass = val.split(' / ')[1]
      //     arr = this.Options.filter(item => {return item.SubClass === subClass})
      //   }
      //   this.searchobj = {
      //     MainClassID: arr?.length > 0 ? arr[0].MainID : 0,
      //     ClassID: arr?.length > 0 ? arr[0].ClassID : 0
      //   }
      //   if(val === '未知分类'){
      //     this.searchobj.MainClassID = 999
      //     this.searchobj.ClassID = 0
      //   }
      //   this.GetShadowURLLog(this.searchobj)
      // }
    },
    tabClick(row){
      this.tabTitle = row.label
      switch (this.tabTitle) {
        case '日期趋势':
          this.GetShadowURLSumGroupByDate()
          break;
        case '用户分析':
          this.GetShadowURLSumGroupByIp()
          break;
        case '域名分类':
          this.GetShadowURLSumGroupByMainClass()
          break;
        case '审计结果':
          this.GetShadowURLSumGroupByAccessType()
          break
        default:
          this.GetShadowURLSumGroupBySubClass()
          break;
      }
    },
    // 获取部门和终端用户
    async GetDepartment(){
      const departments = await connrequest('GetDepartment')
      const employees = await connrequest('GetEmployee')
      departments.Data.map(item => {
        item.SubClass = item.DepartmentName
      })
      employees.Data.map(item => {
        item.SubClass = item.Name,
        item.ParentID = item.DID
      })
      this.getnewarr(departments.Data, employees.Data)
    },
    getnewarr(departments, employees){
      const newDepartmentArray = [];
      //遍历departments数组
      departments.forEach(department => {
          //新建一个对象，用于存储合并后的数据
          const newDepartmentObj = {
              DepartmentName: department.DepartmentName,
              SubClass: department.DepartmentName,
              ParentName: department.ParentName,
              ID: department.ID,
              ParentID: department.ParentID,
              children: []
          };
          //遍历employees数组
          employees.forEach(employee => {
              //如果employee的Department和department的DepartmentName相同
              if (employee.Department === department.DepartmentName) {
                  //将该employee对象添加到newDepartmentObj的children数组中
                  newDepartmentObj.children.push(employee);
              }
          });
          //将newDepartmentObj添加到newDepartmentArray数组中
          newDepartmentArray.push(newDepartmentObj);
      });
      const convertedArray = this.convertArray(newDepartmentArray);
      this.formOptions.map( item => {
        if(item.label === '终端用户'){
          item.options = convertedArray
        }
      })
    },
    convertArray(data) {
      const map = {};
      const result = [];
      data.forEach(item => {
        if(!item.children){
          item.children = [];
        }
        map[item.ID] = item;
      });
      data.forEach(item => {
        if (item.ParentID !== 0) {
          const parent = map[item.ParentID];
          parent.children.push(item);
        } else {
          result.push(item);
        }
      });
      return result;
    },
    // 获取域名分类
    async GetParamDictURL(){
      const res = await connrequest('GetParamDictURL')
      this.Options = res.Data
      let arr = []
      let idlist = []
      res.Data = res.Data || []
      res.data = res.Data.map(item => {
        arr.push(item.MainClass)
        idlist.push(item.MainID)
      })
      arr = Array.from(new Set(arr))
      idlist = Array.from(new Set(idlist))
      // // 给原数组加根节点
      // arr.map((item,index) => {
      //   res.Data.push({ClassID: 0, MainID: idlist[index], MainClass: "根节点", SubClass: item, CreateEvent: 0})
      // })
      this.formOptions.map( item => {
        if(item.label === '域名分类'){
          // item.options = getTreeData(this.treeing(res.Data))
           item.options = [...item.options,...this.processData(res.Data)]

        }
      })
    },
    processData(data) {
      // 1. 提取所有 MainClass
      const allMainClasses = data.map(item => item.MainClass);

      // 2. 去重（使用 Set）
      const uniqueMainClasses = [...new Set(allMainClasses)];

      // 3. 格式化为 el-select 数据源
      const selectOptions = uniqueMainClasses.map(mainClass => ({
        label: mainClass,
        value: mainClass
      }));
      return selectOptions;
    },
    treeing(arr) {
      let res = [] // 存放结果集
      let map = {}
      // 判断对象是否有某个属性
      let getHasOwnProperty = (obj, property) => Object.prototype.hasOwnProperty.call(obj, property)
      // 边做map存储，边找对应关系
      for (const i of arr) {
        map[i.SubClass] = {
            ...i,
            children: getHasOwnProperty(map, i.SubClass) ? map[i.SubClass].children : []
        }
        const newItem = map[i.SubClass]
        if (i.MainClass === '根节点') {
          res.push(newItem)
        } else {
          if (!getHasOwnProperty(map, i.MainClass)) {
            map[i.MainClass] = {
              children: []
            }
          }
          map[i.MainClass].children.push(newItem)
        }
      }
      return res
    },
    // 获取事件日期统计
    async GetShadowURLSumGroupByDate() {
      let xAxis = []
      let series= []
      const data = {
        Filter:{
          StartTime: this.searchform.timeRange?.[0] ||  '',
          EndTime: this.searchform.timeRange?.[1] || '',
          Name: this.searchform?.Name ? this.searchform?.Name[this.searchform.Name.length - 1] : '',
          Descp: this.searchform.URL || '',
          SumCount: 10
        }
      }
      const res = await connrequest('GetShadowURLSumGroupByDate', data)
      res.Data = res.Data || []
      res.Data.map( item =>{
        xAxis.push(item.Name)
        series.push(item.Count)
      })
      this.barchartData = {xAxis,series}
    },
    // 获取审计用户统计
    async GetShadowURLSumGroupByIp(){
      let arr = []
      const data = {
        Filter:{
          StartTime: this.searchform.timeRange?.[0] ||  '',
          EndTime: this.searchform.timeRange?.[1] || '',
          TransDate: '',
          AccessType: '0',
          MainClassID: '0',
          ClassID: '0',
          Name: this.searchform?.Name ? this.searchform?.Name[this.searchform.Name.length - 1] : '',
          URL: this.searchform.URL || '',
          SumCount: 10
        }
      }
      const res = await connrequest('GetShadowURLSumGroupByIp', data)
      res.Data = res.Data || []
      res.Data.map( item =>{
        arr.push({name: item.Name, value: item.Count})
      })
      this.pie1Data = arr

    },
    // 获取域名大类统计
    async GetShadowURLSumGroupByMainClass(){
      let arr = []
      const data = {
        Filter:{
          StartTime: this.searchform.timeRange?.[0] ||  '',
          EndTime: this.searchform.timeRange?.[1] || '',
          Name: this.searchform?.Name ? this.searchform?.Name[this.searchform.Name.length - 1] : '',
          Descp: this.searchform.URL || '',
          SumCount: 10
        }
      }
      const res = await connrequest('GetShadowURLSumGroupByMainClass', data)
      res.Data = res.Data || []
      res.Data.map( item =>{
        arr.push({name:item.Name || '未知分类', value: item.Count, id: item.ClassID})
      })
      this.pie2Data = arr
    },
    // 获取域名小类统计
    async GetShadowURLSumGroupBySubClass(){
      let arr = []
      const data = {
        Filter:{
          StartTime: this.searchform.timeRange?.[0] ||  '',
          EndTime: this.searchform.timeRange?.[1] || '',
          Name: this.searchform?.Name ? this.searchform?.Name[this.searchform.Name.length - 1] : '',
          Descp: this.searchform.URL || '',
          SumCount: 10
        }
      }
      const res = await connrequest('GetShadowURLSumGroupBySubClass', data)
      res.Data = res.Data || []
      res.Data.map( item =>{
        arr.push({name: ParamDictURLtype(item.ClassID), value: item.Count, id: item.ClassID})
      })
      this.pie3Data = arr
    },
    // 按审计结果统计
    async GetShadowURLSumGroupByAccessType(){
      let arr = []
      const data = {
        Filter:{
          StartTime: this.searchform.timeRange?.[0] ||  '',
          EndTime: this.searchform.timeRange?.[1] || '',
          Name: this.searchform?.Name ? this.searchform?.Name[this.searchform.Name.length - 1] : '',
          Descp: this.searchform.URL || '',
          SumCount: 10
        }
      }
      const res = await connrequest('GetShadowURLSumGroupByAccessType', data)
      res.Data = res.Data || []
      res.Data.map( item =>{
        arr.push({name: item.ClassID = item.ClassID === 1 ? '禁止' : (item.ClassID === 2 ? '加速' : '直连'), value: item.Count})
      })
      this.pie4Data = arr
    },
    // 获取审计日志列表
    async GetShadowURLLog(searchobj = {}){
      let arr
      if(this.searchform?.type?.length > 0){
        let subClass = this.searchform?.type[this.searchform?.type?.length - 1]
        arr = this.Options.filter(item => {return item.SubClass === subClass})
      }
      const data = {
        Paging: {
          QueryPageNo: this.pageNum,
          QueryPageLength: this.pageSize
        },
        Filter: {
          StartTime: this.searchform.timeRange?.[0] ||  '',
          EndTime: this.searchform.timeRange?.[1] || '',
          // TransDate: getNowDay(),
          AccessType: this.searchform.AccessType,
          MainClassID: arr?.length > 0 ? arr[0].MainID * 1 : 0,
          // ClassID: arr?.length > 0 ? arr[0].ClassID * 1 : 0,
          URLClass: this.searchform?.type,
          TransDate:'',
          Name: this.searchform?.Name ? this.searchform?.Name[this.searchform.Name.length - 1] : '',
          URL: this.searchform.URL || '',
          ...searchobj
        }
      }
    
      const res = await connrequest('GetShadowURLLog', data)
      res.Data = res.Data || []
      res.Data.map( item =>{
        // item.Class = item.Class? item.Class : '未知分类'
        // item.ClassID = ParamDictURLtype(item.ClassID)
        item.TransTime = parseTime(item.TransTime, '{y}-{m}-{d} {h}:{i}:{s}')
        item.AccessType = item.AccessType === 1 ? '禁止' : (item.AccessType === 2 ? '加速' : '直连')
      })
      this.tableData = res.Data
      this.total = res.Paging.TotalCount
    },
    handleSizeChange(val){
      this.pageNum = 1
      this.pageSize = val
      this.GetShadowURLLog(this.searchobj)
    },
    handleCurrentChange( pageNum ){
      this.pageNum = pageNum
      this.GetShadowURLLog(this.searchobj)
    },
    search(val) {
      this.pageNum = 1
      this.searchform = {...val}

      if(this.searchform.timeRange){
        this.searchobj = { StartTime: this.searchform?.timeRange[0] || '', EndTime: this.searchform?.timeRange[1] || '' }
      }
      this.getData()
    },
    reset() {
      let xTime = new Date().getTime()
      let endTime = new Date(new Date().setHours(0, 0, 0, 0))
      let startTime = endTime - (Cookies.get('DefaultLogDays') * 1 * 3600 * 24 * 1000);
      // let arr = [ parseTime(startTime), parseTime(xTime)]
      let arr = [ parseTime(startTime), '']
      this.pageNum = 1
      this.formOptions = this.formOptions.map( item => {
        if(item.label === "日期"){
          item.initValue = arr
        }else if(item.label === "域名分类"){
          item.initValue = ""
        }else if(item.label === "统计排名"){
          item.initValue = 10
        }else if(item.label === "审计策略"){
          item.initValue = 0
        }else{
          item.initValue = ""
        }
        return item
      })
      this.searchform = {}
      // searchobj也需要重置为空，因为请求日志时带上了这个数据。如果不为空，AccessType有两个值，第一个searchform的AccessType为空
      //但第二个的searchobj的值会继续保留我们点击饼状图的AccessType的值
      this.searchobj = {}
      this.$set(this.searchform,'timeRange', arr)
      this.$refs.connsearch.addInitValue()
      this.getData()
    },
    handleClick() {
      this.tab = !this.tab
    }
  }
};
</script>
<style lang="scss" scoped>
@import "~@/styles/variables.scss";
@import "./components/css/conncss.scss";
.night{
  .Dialog-title{
    color: #fff;
  }
}
</style>
